package com.edie.customview.modular;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.edie.customview.R;

public class NestedScrollActivity extends AppCompatActivity {

    private RecyclerView rv;

    public static void start(Context context) {
        context.startActivity(new Intent(context, NestedScrollActivity.class));
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_nested_scroll);
//        setContentView(R.layout.activity_nested_scroll1);

        setContentView(R.layout.activity_nested_scroll2);
        initView();
    }

    private void initView() {
        rv = (RecyclerView) findViewById(R.id.rv);
        rv.setLayoutManager(new LinearLayoutManager(this));
        rv.setAdapter(new HHAdapter());
    }

    static class HHViewHolder extends RecyclerView.ViewHolder {
        HHViewHolder(View itemView) {
            super(itemView);
        }
    }

    class HHAdapter extends RecyclerView.Adapter<HHViewHolder> {
        @NonNull
        @Override
        public HHViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
            TextView view = new TextView(NestedScrollActivity.this);
            view.setPadding(10,10,10,10);
            return new HHViewHolder(view);
        }

        @Override
        public void onBindViewHolder(@NonNull HHViewHolder holder, int position) {
            TextView itemView = (TextView) holder.itemView;
            itemView.setText("jfskdjl"+position);
        }

        @Override
        public int getItemCount() {
            return 60;
        }
    }
}
